using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;
using Utility;

namespace BUS
{
   public  class PHANQUYEN_QUANLY_BUS
    {
        public static void insert(PHANQUYEN_QUANLY_DTO pqql)
        {
            PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
            pqqldal.insert(pqql);
        }
       public static void update(PHANQUYEN_QUANLY_DTO pqql)
       {
           PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
           pqqldal.update(pqql);
       }
       public static void insert(int pqql)
       {
           PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
           pqqldal.delete(pqql);
       }
       public static PhanQuyen_QuanLyColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
       {
           PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
           return pqqldal.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
       }
       public static PhanQuyen_QuanLyColection GetAll()
       {
           int total = 0;
           Criteria cri = new Criteria();
           PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
           return pqqldal.Get(cri.Criter, 0, 0, tbPhanQuyen_QuanLyColumns.MaQuyen.ToString(), OrderDirection.ASC.ToString(), out total);
       }
       public static PHANQUYEN_QUANLY_DTO GetByID(int iD)
       {
           int total = 0;
           Criteria cri = new Criteria();
           cri.add(Condition.AND, tbPhanQuyen_QuanLyColumns.MaQuyen.ToString(), Condition.EQUAL, iD);
           PHANQUYEN_QUANLY_DAL pqqldal = new PHANQUYEN_QUANLY_DAL();
           PhanQuyen_QuanLyColection pqqlcltion = pqqldal.Get(cri.Criter, 0, 0, tbPhanQuyen_QuanLyColumns.MaQuyen.ToString(), OrderDirection.ASC.ToString(), out total);
           if (pqqlcltion.Count > 0)
               return pqqlcltion[0];
           return null;

       }
    }
}
